<?php
/** @var ContentController $this */
/** @var Channel $channel */
/** @var TbActiveForm $form */

$channel = $this->getChannel();
$this->pageTitle = $channel->title;

$this->menu = Channel::model()->getContentMenuItems($channel->id);
?>

<div class="content-dashboard row-fluid">
	<div class="span2">
		<?php
		$this->beginWidget('bootstrap.widgets.TbBox', array(
			'title' => '栏目' . CHtml::link('管理', array('/channel/index')),
		));
		?>
		<?php
		$items = Channel::model()->getContentMenuItems();
		$this->widget('YJsTreeWidget', array(
			'items' => $items,
			'htmlOptions' => array('class' => 'channel-tree', 'id' => 'channel-tree'),
			'selected' => $channel->id,
			/*
			'options' => array(
				'core' => array(
					'animation' => 0,
					'check_callback' => true,
				),
				'types' => array(

				),
				'plugins' => array("dnd", "types",  "wholerow"),
			)*/
		));
		?>
		<?php $this->endWidget() ?>
	</div>

	<div class="span10">
		<div class="content-render-container" id="content-reader-container">
			<div class="page-header">
				<h1>
					<?php echo $this->pageTitle; ?>
				</h1>
			</div>
			<?php
			$this->widget('bootstrap.widgets.TbExtendedGridView', array(
				'id' => 'channel-grid',
				'dataProvider' => new CArrayDataProvider($channel->getTree($channel->id), array(
						'pagination' => array(
							'pageSize' => 50,
						),
					)),
				//'rowHtmlOptionsExpression' => 'array("class"=>"level-" .$data->depth)',
				'columns' => array(
					array(
						'name' => 'title',
						'type' => 'raw',
						'header' => $channel->getAttributeLabel('title'),
						'value' => '"<span class=\"depth-indent\">" . str_repeat(" — ", $data->depth) . "</span>" . $data->title',
						'htmlOptions' => array('class' => 'title-column'),
					),
					array(
						'name' => 'name',
						'header' => $channel->getAttributeLabel('name'),
					),
					array(
						'header' => '操作',
						'type' => 'raw',
						'value' => '$data->getContentActionLink()',
					),
				),
			)); ?>
		</div>
	</div>
</div>
